import axios from '../plugin/axios/axios'

//基地
export const Basetoincrease = (baseId) => {
  return axios({
      url: `/api/v1/bases/around/base/${baseId}`,
      method: 'GET',
  },true)
}
//获取默认基地列表
export const baseLst = (present,length) => {
    return axios({
        url: `/api/v1/bases?page_no=${present}&per_page=${length}`,
        method: 'GET',
    },true)
}
//获取未上架基地
export const baseLstdown = (addressCode,dowm,present,length) => {
    return axios({
        url: `/api/v1/bases?status=${dowm}&page_no=${present}&per_page=${length}${addressCode ? '&addressCode=' + addressCode : ''}`,
        method: 'GET',
    },true)
}
//基地详情
export const baseparticulars = (id) => {
    return axios({
        url: `/api/v1/bases/${id}`,
        method: 'GET',
    },true)
}
//编辑基地
export const basecompile = (baseId,data) => {
    if (data['thumbnail'] == '') 
        delete data.thumbnail;
    return axios({
        url: `/api/v1/bases/${baseId}`,
        method: 'PUT',
        data
    },true)
}
//选择区域
export const basearea = (addressCode,present,length) => {
    return axios({
        url: `/api/v1/bases/areas/${addressCode}?page_no=${present}&per_page=${length}`,
        method: 'GET',
    },true)
}
//添加基地
export const baseadd = (data) => {
    if (data['thumbnail'] == '') 
        delete data.thumbnail;
    return axios({
        url: `/api/v1/bases`,
        method: 'POST',
        data
    },true)
}
// 添加基地介绍
export const baseintroduce = (baseId) => {
    return axios({
        url: `/api/v1/bases/info/new/${baseId}`,
        method: 'GET',
    },true)
}
//基地介绍修改
export const baseIntroductiontomodify = (data,baseId) => {
    return axios({
        url: `/api/v1/bases/info/${baseId}`,
        method: 'PUT',
        data
    },true)
}
//项目添加
export const ProgramList = (baseId) => {
    return axios({
        url: `/api/v1/bases/course/base/${baseId}`,
        method: 'GET',
    },true)
}
//项目修改
export const projectamend = (id,data) => {
    return axios({
        url: `/api/v1/bases/course/${id}`,
        method: 'PUT',
        data
    },true)
}
//基地项目添加
export const projectadd = (data) => {
    return axios({
        url: `/api/v1/bases/course`,
        method: 'POST',
        data
    },true)
}
//基地项目删除
export const BaseprojectDelete = (id) => {
    return axios({
        url: `/api/v1/bases/course/${id}`,
        method: 'DELETE',
    },true)
}
//获取基地类型
export const basetype = (Data) => {
    return axios({
        url: `api/v1/const/BASE_TYPE`,
        method: 'GET',
        Data
    },true)
}
//获取所有轮播图数据
export const slideshow = (targetId) => {
    return axios({
        url: `/api/v1/carousel/project/${targetId}`,
        method:'GET'
    },true)
}
//轮播图添加
export const slideshowadd = (data,targetId) => {
    return axios({
        url: `/api/v1/carousel/project/${targetId}`,
        method:'POST',
        data
    },true)
}
//基地轮播图删除
export const BaseslideshowDelete = (id) => {
    return axios({
        url: `/api/v1/carousel/${id}`,
        method: 'DELETE',
    },true)
}
//轮播图修改
export const Baseslideshowmodification = (data,id) => {
    return axios({
        url: `/api/v1/carousel/${id}`,
        method: 'PUT',
        data
    },true)
}
//基地介绍
export const itemadd = (id) => {
    return axios({
        url: `/api/v1/bases/info/${id}`,
        method: 'PUT'
    },true)
}
//获取周边基地
export const baserim = (baseId) => {
    return axios({
        url: `/api/v1/bases/around/base/${baseId}`,
        method: 'GET'
    },true)
}
//添加周边基地
export const baserimadd = (data) => {
    return axios({
        url: `/api/v1/bases/around`,
        method: 'POST',
        data
    },true)
}
//删除周边基地
export const baserimdelete = (id) => {
    return axios({
        url: `/api/v1/bases/around/${id}`,
        method: 'DELETE',
    },true)
}
//获取指定周边基地
export const baserimamend = (data,id) => {
    return axios({
        url: `/api/v1/bases/around/${id}`,
        method: 'PUT',
        data
    },true)
}
//搜索
export const baserimsearch = (name,type) => {
    return axios({
        url: `/api/v1/bases?name=${name}&status=${type}`,
        method: 'GET',
    },true)
}
//区域接口
export const area = () => {
    return axios({
        url: `/api/v1/areas/level/district?parentCode=331100`,
        method: 'GET',
    },true)
}
//获取所有管理员
export const AdministratorList = (baseId) => {
    return axios({
        url: `/api/v1/base_managers/${baseId}`,
        method: 'GET',
    },true)
}
//管理员账号添加
export const Basemanageradd = (data) => {
    return axios({
        url: `/api/v1/base_managers`,
        method: 'POST',
        data
    },true)
}
//基地上下架
export const BaseStandupanddown = (baseId,status) => {
    return axios({
        url: `/api/v1/bases/${baseId}/${status}`,
        method: 'PUT'
    },true)
}
//获取基地编号
export const GetbaseID = () => {
    return axios({
        url: `/api/v1/dirty/base/up`,
        method: 'GET'
    },true)
}
//管理员添加
export const AdministratorListadd = (data) => {
    return axios({
        url: `/api/v1/user/admin`,
        method: 'POST',
        data
    },true)
}
//管理员列表
export const gainAdministratorList = () => {
    return axios({
        url: `/api/v1/user/admin`,
        method: 'GET'
    },true)
}
export default {
    Basetoincrease,
    baseLst,
    baseparticulars,
    basecompile,
    basearea,
    basetype,
    baseintroduce,
    projectadd,
    ProgramList,
    projectamend,
    slideshow,
    slideshowadd,
    BaseprojectDelete,
    itemadd,
    baserim,
    BaseslideshowDelete,
    baserimadd,
    baserimdelete,
    baserimamend,
    Baseslideshowmodification,
    baseIntroductiontomodify,
    baserimsearch,
    baseadd,
    area,
    AdministratorList,
    Basemanageradd,
    BaseStandupanddown,
    baseLstdown,
    GetbaseID,
    gainAdministratorList,
    AdministratorListadd
}